package com.atom.zx.util;

public enum Logs {
    ;
    public static void e(Object... contents){
        System.out.print(processBody(contents));
    }

    private static String processBody(Object... contents) {
        String body = "null";
        if (contents != null) {
            StringBuilder sb = new StringBuilder();
            int i = 0;

            for(int len = contents.length; i < len; ++i) {
                Object content = contents[i];
                sb.append("args").append("[").append(i).append("]").append(" = ").append(formatObject(content)).append(System.getProperty("line.separator"));
            }

            body = sb.toString();
        }

        return body.length() == 0 ? "log nothing" : body;
    }

    private static String formatObject(Object object) {
        if (object == null) {
            return "null";
        } else {
            return String.valueOf(object);
        }
    }
}
